﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Autoverwaltung.GUI.ViewManager
{
    /// <summary>
    /// Interaktionslogik für UCAnsichtenContainer.xaml
    /// </summary>
    public partial class UCViewContainer : UserControl
    {
        private IView activeView;
        private IView nextView;

        public UCViewContainer()
        {
            InitializeComponent();
        }

        public bool ChangeView(IView view)
        {
            if(view != null)
            {
                if (this.activeView == null || (this.activeView != null &&
                    !this.activeView.IsLocked && this.activeView.UIElement != view.UIElement))
                {
                    this.activeView = view;
                    //this.MoveOutAnimation();
                    this.grdAnimatable.Children.Clear();
                    this.grdAnimatable.Children.Add(this.activeView.UIElement);
                    return true;
                }
            }

            return false;
        }
    }
}
